#include <iostream>
using namespace std;
class SolidFigure{
    public:
    virtual double getSuperficialArea()=0;
    virtual double getVolume()=0;
    virtual void showAll()=0;
};

class Cuboid:public SolidFigure{
    double width,length,height;
public:
    Cuboid(double w,double l,double h){
        width=w;
        length=l;
        height=h;
    }
    double getSuperficialArea(){
        return 2*(width*length+width*height+height*length);
    }
    double getVolume(){
        return width*length*height;
    }
    void showAll(){
        cout<<"Cuboid:"<<endl;       
        cout<<"长: "<<length<<endl;
        cout<<"宽: "<<width<<endl;
        cout<<"高: "<<height<<endl;
        cout<<"表面积: "<<getSuperficialArea()<<endl;
        cout<<"体积: "<<getVolume()<<endl;
    }
};

class Sphere:public SolidFigure{
    double radius;
    const double PI=3.1415926;
public:
    Sphere(double r){
        radius=r;
    }
    double getSuperficialArea(){
        return 4*PI*radius*radius;
    }
    double getVolume(){
        return 4.0/3*PI*radius*radius*radius;
    }
    void showAll(){
        cout<<"Sphere:"<<endl;   
        cout<<"半径: "<<radius<<endl;   
        cout<<"表面积: "<<getSuperficialArea()<<endl;
        cout<<"体积: "<<getVolume()<<endl;
    }
};

class Cylinder:public SolidFigure{
    double radius,height;
    const double PI=3.1415926;
public:
    Cylinder(double r,double h){
        radius=r;
        height=h;
    }
    double getSuperficialArea(){
        return 2*PI*radius*(radius+height);
    }
    double getVolume(){
        return PI*radius*radius*height;
    }
    void showAll(){
        cout<<"Cylinder:"<<endl;   
        cout<<"半径: "<<radius<<endl;   
        cout<<"高: "<<height<<endl;   
        cout<<"表面积: "<<getSuperficialArea()<<endl;
        cout<<"体积: "<<getVolume()<<endl;
    }
};

int main(){
    SolidFigure *p[3];
    p[0]=new Cuboid(10,10,10);
    p[1]=new Sphere(10);
    p[2]=new Cylinder(10,10);
    for(int i=0;i<3;i++){
        p[i]->showAll();
        cout<<endl;
    }
    for(int i=0;i<3;i++){
        delete p[i];
    }
    return 0;
}